package lights;

import java.util.List;

import org.junit.Assert;
import org.junit.Test;

public class MyHolidayLightTest {
	@Test public void ConstructorTest(){
		boolean isRandom = false, isOn = false;
		MyHolidayLight mlh = new MyHolidayLight(10);
		List<Light> lightList = mlh.next();
		Light before = lightList.get(0);
		isOn = lightList.get(0).isOn();
		for(Light l : lightList){
			if (((ColoredLight) l).getColor()!=((ColoredLight) before).getColor()) isRandom = true;
			isOn = isOn && l.isOn();
		}
		Assert.assertTrue(isOn&&isRandom);
	}
	
	@Test public void NextTest(){
		MyHolidayLight mlh = new MyHolidayLight(10);
		boolean isOn = true;
		List<Light> lightList = mlh.next();
		for(Light l : lightList)
			isOn = isOn && l.isOn();
		Assert.assertTrue(isOn);
		
		lightList = mlh.next();
		isOn = true;
		for(Light l : lightList)
			isOn = isOn && !l.isOn();
		Assert.assertTrue(isOn);
		
		lightList = mlh.next();
		isOn = true;
		for(Light l : lightList)
			isOn = isOn && l.isOn();
		Assert.assertTrue(isOn);
	}
	
	@Test public void LengthTest(){
		MyHolidayLight mlh = new MyHolidayLight(10);
		Assert.assertTrue(mlh.getLength()==10);
	}
}
